// 高阶组件
// 判断有无token， 把组件当成参数包裹
import { getInfo } from '@/utils/storage.js';
import { Navigate } from 'react-router-dom';

const AuthRoute = ({ children }) => {
  const token = getInfo();
  if (token) {
    return <>{children}</>
  } else {
    return <Navigate to={'/login'} replace />
  }
}

export default AuthRoute;